/**
 * Using for hide item or not by access
 */

import React from 'react';
import PropTypes from 'prop-types';
import './index.scss';

export default class AccessContainer extends React.Component {
  static propTypes = {
    neededRole: PropTypes.array.isRequired,
    role: PropTypes.string,
  };

  render() {
    const { neededRole, role } = this.props;
    return neededRole.includes(role) ? this.props.children : null;
  }
}
